package com.smzd.framework.system.dao;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.smzd.core.dao.AbstractDao;
import com.smzd.core.mappers.IMapper;
import com.smzd.framework.system.domain.Meeting;
import com.smzd.framework.system.mappers.MeetingMapper;
import com.smzd.framework.utils.db.RPage;

@Component
public class MeetingDao extends AbstractDao<Meeting> {
    @Autowired
    private MeetingMapper mapper;

    @Override
    protected IMapper<Meeting> getMapper() {
        return mapper;
    }

    public RPage<Meeting> getAllMeetingsByPage(RPage<Meeting> page) {
        preparePage(page);
        List<Meeting> elems = mapper.getAllMeetingsByPage(page);
        page.setElems(elems);
        int total = mapper.getAllMeetingsCount(page);
        page.setTotalCount(total);
        completePage(page);
        return page;
    }

    public List<Meeting> getMeetingsByOwnerId(int id) {
        return mapper.getMeetingsByOwnerId(id);
    }

    public void updateMeetingOwner(Meeting meeting) {
        mapper.updateMeetingOwner(meeting);
    }

}
